﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class lessonElement : MonoBehaviour {

	public Text index = null;

	public RawImage cover = null;
	public RawImage coverDis = null;

	// Use this for initialization
	void Start () {
		
	}
	
	// Update is called once per frame
	void Update () {
		
	}

	public void Init(string idx, string urlCover )
	{
		index.text = idx;


		ResLoader.Load(urlCover, null, (www)=>{
			if (!string.IsNullOrEmpty( www.error ))
				{
					// error
					Debug.Log("download urlCover error");
				}
				else
				{
					// success , replace cover
					PhotoOperation.FileLoad(ResLoader.Url2LocalPath(urlCover),
						(tex)=>{
							cover.texture = tex;
					}, 
						(err)=>{});
				}
		}, true, true);

	}
}
